/*
 * StartScreen.fx
 *
 * Created on 21 mars 2011, 21:55:04
 */
package view;

import javafx.scene.text.Font;
import javafx.scene.image.Image;
import javafx.animation.Timeline;
import javafx.animation.transition.FadeTransition;
import javafx.scene.CustomNode;
import javafx.scene.Node;
import javafx.scene.Group;
import javafx.scene.image.ImageView;
import vinciappli.Templates;
import javafx.scene.control.Label;
import javafx.scene.paint.Color;

/**
 * @author Sik
 */
public class StartScreen extends CustomNode
{
    
    var screen =
            Label
            {
                font:Font
                {
                    size: 50
                }
                translateX: 320
                translateY:500
                text: "PRESS ENTER TO START"
                textFill: Color.WHITESMOKE
            };

        def intro =
            Image
            {
                //url: "file:///{{Templates.DEFAULT_PATH}}sonic.jpg"
                url: "{{Templates.START_BG_PATH}}"
                backgroundLoading: true

            };

        def background : ImageView =
            ImageView
            {
                image: intro
                x: 0
                y: 0
                fitHeight: Templates.STAGE_HEIGHT
                fitWidth: Templates.STAGE_WIDTH
            }

        def fadeTransition =
            FadeTransition
            {
                duration: 1s node: screen
                fromValue: 1.0 toValue: 0.0
                repeatCount: Timeline.INDEFINITE
                autoReverse: true
            };


    public override function create() : Node
    {
                ini();
                Group
                {
                    content:
                    [
                        background,
                        screen
                    ];
                }

    }
    
    public function ini() : Void
    {
        fadeTransition.play();
    }

    public function close() : Void
    {
        fadeTransition.stop();
    }
    
}
